Removing/Adding a specific variable from an object inside javascript array? [migrated]
Posted
by
hustlerinc
on Game Development
See other posts from Game Development
or by hustlerinc
Published on 2012-03-21T19:12:02Z
Indexed on
2012/03/21
23:41 UTC
Read the original article
Hit count: 201
JavaScript
|html5
I have a map array with objects stuffed with variables looking like this:
var map = [
[{ground:0, object:1}, {ground:0, item:2}, {ground:0, object:1, item:2}],
[{ground:0, object:1}, {ground:0, item:2}, {ground:0, object:1, item:2}]
];
Now I would like to be able to delete and add one of the variables like item:2
.
1) What would I use to delete specific variables?
2) What would I use to add specific variables?
I just need 2 short lines of code, the rest like detecting if and where to execute I've figured out.
I've tried delete map[i][j].item;
with no results.
Help appreciated.
© Game Development or respective owner